package com.hns.phone.safety.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hns.can.base.entity.SysUserEntity;
import com.hns.can.common.domain.GridPage;
import com.hns.can.common.domain.ReturnResult;
import com.hns.can.common.service.CommonInitParamService;
import com.hns.can.common.web.BaseController;
import com.hns.frame.mybatis.Pagination;
import com.hns.phone.safety.service.PhoneOverSpeedService;
import com.hns.phone.safety.vo.OverspeedMonitorParamVo;

@Controller
@RequestMapping("/api/phoneOverSpeed")
public class PhoneOverSpeedController extends BaseController {
	
	@Autowired
    private PhoneOverSpeedService overspeedMonitorService; // 注入overspeedMonitorService
	
	@Autowired
    protected CommonInitParamService commonInitParamService;
	
	/**
	 * 得到超速信息表
	 * @param conditionVo
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 * @author:zhangyu
	 * @email:zhangyu2222z@sina.cn
	 */
    @RequestMapping("/getOverspeedPage")
    @ResponseBody
    public Object getOverspeedPage(OverspeedMonitorParamVo conditionVo, HttpServletRequest request, 
                HttpServletResponse response) throws Exception {
        SysUserEntity user = this.getPhoneCurrentUser();
        conditionVo.setCorpId(user.getCorpId());
        conditionVo.setDriverRelTableName("T_COMM_CAR_SPDING");
      //初始化开始结束时间
    	commonInitParamService.dateType2DateTime(conditionVo, conditionVo.getTimeType());
        Pagination page = overspeedMonitorService.searchOverspeedPage(conditionVo,request);
        GridPage grid = new GridPage(page);
        return new ReturnResult(grid);
    }
}
